from models import db, BaseModel


class Menu(BaseModel):
    """
    菜单模型
    """
    __tablename__ = "sys_menu"
    __table_args__ = ({"comment": "菜单"})
    appCode = db.Column(db.String, name="app_code", unique=False, nullable=True, comment="应用编码")
    parentId = db.Column(db.BigInteger, name="parent_id", unique=False, nullable=True, comment="父ID")
    name = db.Column(db.String, name="name", unique=False, nullable=True, comment="菜单名称")
    code = db.Column(db.String, name="code", unique=False, nullable=True, comment="唯一编码")
    pids = db.Column(db.String, name="pids", unique=False, nullable=True, comment="父ID集合")
    type = db.Column(db.Integer, name="type", unique=False, nullable=True, comment="菜单类型<sys_menu_type>")
    sort = db.Column(db.BigInteger, name="sort", unique=False, nullable=True, comment="排序")
    path = db.Column(db.String, name="path", unique=False, nullable=True, comment="路由地址")
    component = db.Column(db.String, name="component", unique=False, nullable=True, comment="组件地址")
    icon = db.Column(db.String, name="icon", unique=False, nullable=True, comment="菜单图标")
    isShow = db.Column(db.Integer, name="is_show", unique=False, nullable=True, comment="是否显示")
    isLink = db.Column(db.Integer, name="is_link", unique=False, nullable=True, comment="是否链接")
    url = db.Column(db.String, name="url", unique=False, nullable=True, comment="外部链接地址")
    enabled = db.Column(db.Integer, name="enabled", unique=False, nullable=True, comment="是否启用")
    openType = db.Column(db.Integer, name="open_type", unique=False, nullable=True, comment="打开方式<sys_menu_open_type>")
    isCache = db.Column(db.Integer, name="is_cache", unique=False, nullable=True, comment="是否缓存")
    isSync = db.Column(db.Integer, name="is_sync", unique=False, nullable=True, comment="是否同步")
    variable = db.Column(db.String, name="variable", unique=False, nullable=True, comment="额外参数JSON")
